function getClientMsg() {
	// 呈现引擎
	var engine = { ie : 0, gecko : 0, webkit : 0, khtml : 0, opera : 0, 
			// 完整的版本号 
			ver : null	};
	// 浏览器
	var browser = {
		// 主要浏览器
		IE : 0, Firefox : 0, Safari : 0, Konq : 0, Opera : 0, Chrome : 0,
		// 具体的版本号
		ver : null	};
	// 平台、设备和操作系统
	var system = {
		Win : false, Mac : false, x11 : false,
		// 移动设备
		IOS : false,
		Android : false, NokiaN : false, WinMobile : false
	};
	// 检测呈现引擎和浏览器
	var ua = navigator.userAgent;
	if (window.opera) {
		engine.ver = browser.ver = window.opera.version();
		engine.opera = browser.Opera = parseInt(engine.ver);
	} else if (/AppleWebKit\/(\S+)/.test(ua)) {
		engine.ver = RegExp["$1"];
		engine.webkit = parseInt(engine.ver);
		// 确定是Chrome 还是Safari
		if (/Chrome\/(\S+)/.test(ua)) {
			browser.ver = RegExp["$1"];
			browser.Chrome = parseInt(browser.ver);
		}
		else if (/Version\/(\S+)/.test(ua)) {
			browser.ver = RegExp["$1"];
			browser.Safari = parseInt(browser.ver);
		} else {
			// 近似地确定版本号
			var safariVersion = 1;
			if (engine.webkit < 100) {
				safariVersion = 1;
			} else if (engine.webkit < 312) {
				safariVersion = 1.2;
			} else if (engine.webkit < 412) {
				safariVersion = 1.3;
			} else {
				safariVersion = 2;
			}
			browser.Safari = browser.ver = safariVersion;
		}
	} else if (/KHTML\/(\S+)/.test(ua) || /Konqueror\/([^;]+)/.test(ua)) {
		engine.ver = browser.ver = RegExp["$1"];
		engine.khtml = browser.konq = parseInt(engine.ver);
	} else if (/rv:([^\)]+)\) Gecko\/\d{8}/.test(ua)) {
		engine.ver = RegExp["$1"];
		engine.gecko = parseInt(engine.ver);
		// 确定是不是Firefox
		if (/Firefox\/(\S+)/.test(ua)) {
			browser.ver = RegExp["$1"];
			browser.Firefox = parseInt(browser.ver);
		}
	} else if (/MSIE ([^;]+)/.test(ua)) {
		engine.ver = browser.ver = RegExp["$1"];
		engine.ie = browser.IE = parseInt(engine.ver);
	}
	// 检测浏览器
	browser.IE = engine.ie;
	browser.Opera = engine.opera;
	// 检测平台
	var p = navigator.platform;
	system.Win = p.indexOf("Win") == 0;
	system.Mac = p.indexOf("Mac") == 0;
	system.x11 = (p == "X11");
	// 检测Windows 操作系统
	if (system.Win) {
		if (/Win(?:dows )?([^do]{2})\s?(\d+\.\d+)?/.test(ua)) {
			if (RegExp["$1"] == "NT") {
				switch (RegExp["$2"]) {
				case "5.0":
					system.Win = "2000";
					break;
				case "5.1":
					system.Win = "XP";
					break;
				case "6.0":
					system.Win = "Vista";
					break;
				case "6.1":
					system.Win = "7";
					break;
				case "6.2":
					system.Win = "8";
					break;
				default:
					system.Win = "NT";
					break;
				}
			} else if (RegExp["$1"] == "8") {
				system.Win = "8";
			} else {
				system.Win = RegExp["$1"];
			}
		}
	}else{//是否是移动设备
		//iphone : false, ipod : false, ipad : false, 
		if(ua.indexOf("iPhone") > -1 || ua.indexOf("iPod") > -1 || ua.indexOf("iPad")> -1){
			system.IOS = true;
		}
		system.NnokiaN = ua.indexOf("NokiaN") > -1;
		system.Android = ua.indexOf("Android") > -1;
		// 检测iOS 版本
		if (system.IOS && ua.indexOf("Mobile") > -1) {
			if (/CPU (?:iPhone )?OS (\d+_\d+)/.test(ua)) {
				system.IOS = parseInt(RegExp.$1.replace("_", "."));
			} else {
				system.IOS = 2; // 不能真正检测出来，所以只能猜测
			}
		}
		// 检测Android 版本
		if (/Android (\d+\.\d+)/.test(ua)) {
			system.Android = parseInt(RegExp.$1);
		}
	}
	// 返回这些对象
	return { engine : engine, browser : browser, system : system };
};

/**
 * 获取客户端系统浏览器等信息
 */
function getClientOSAndBrowser(){
	var clientMsg = getClientMsg();
	var os, osVer, browser, browserVer;
	for(var platform in clientMsg.system){
		if(clientMsg.system[platform]){
			os = platform;
			osVer = clientMsg.system[platform];
			break;
		}
	}
	if(!os){os = "other";}
	for(var bro in clientMsg.browser){
		if(clientMsg.browser[bro]){
			if(bro=="IE"){
				browser = "IE"+clientMsg.browser[bro];
			}else{
				browser = bro;
			}
			browserVer = clientMsg.browser[bro];
			break;
		}
	}
	if(!browser){browser = "other";}
	return {os : os, osVer : osVer, browser : browser, browserVer : browserVer};
}
	
	
	function isComputer(){
		var p = navigator.platform.toLowerCase();    
	    var win = p.indexOf("win") == 0;    
	    var mac = p.indexOf("mac") == 0;    
	    var x11 = (p == "X11");    
	    return win||mac||x11;
	}
	
	function getClient(){
		var osAndBrowser = getClientOSAndBrowser();
		var clientMsg = "系统类型:"+osAndBrowser.os+"<br>系统版本:"+osAndBrowser.osVer+"<br>浏览器类型:"
		+osAndBrowser.browser + "<br>浏览器版本:"+osAndBrowser.browserVer;
		clientMsg += "<br>浏览器代理信息:"+navigator.userAgent;
		document.getElementById("msg").innerHTML = clientMsg;
		alert(navigator.userAgent.length);
		//将用户基本信息传到后台
		jQuery.ajax({
			url: "UserAgent",
			type: "post",
			data : {data:clientMsg},
			dataType:"text",  
			success: function(data){
				//alert("succ");
			},
			error: function (jqXHR, textStatus, errorThrown) {
	            alert(jqXHR.responseText);
	            console.log(jqXHR.responseText);
	        }
		});
		
	}